<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>fold——collapse</title>


    <style>
        * {
            margin: 0%;
            padding: 0%;
            box-sizing: border-box;
        }

        html,body {
            width: 100%;
            height: 200%;
        }

        ul,
        ol {
            list-style: none;
        }

        .box {
            overflow: hidden;
            max-width: 1320px;
            height: 527px;
            margin: 100px auto;
        }

        .box ul {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1fr;
            grid-template-rows: 527px;
            gap: 8px;
            transition: all .5s;
        }

        .box .item {
            position: relative;
            background-color: aqua;
        }

        /* 鼠标经过小li，让父亲 ul 修改里面的份数   has 父亲选择器 */
        /* 当鼠标经过了第一个小li(.item)的时候，选择 父亲 ul */
        .box ul:has(.item:nth-child(1):hover) {
            grid-template-columns: 2fr 1fr 1fr 1fr;
        }

        .box ul:has(.item:nth-child(2):hover) {
            grid-template-columns: 1fr 2fr 1fr 1fr;
        }

        .box ul:has(.item:nth-child(3):hover) {
            grid-template-columns: 1fr 1fr 2fr 1fr;
        }

        .box ul:has(.item:nth-child(4):hover) {
            grid-template-columns: 1fr 1fr 1fr 2fr;
        }

        .item p {
            font-size: 30px;
            position: absolute;
            left: 0;
            bottom: -100px;
            color: #fff;
            padding: 20px;
        }

        /* 鼠标经过.item里面的p升上来 */
        .item:hover p {
            bottom: 0;
            transition: all .5s;
        }

    </style>
</head>
<body>
    <div class="box">
      <ul>
        <li class="item">
          <p>超长质保</p>
        </li>
        <li class="item">
          <p>超长质保</p>
        </li>
        <li class="item">
          <p>超长质保</p>
        </li>
        <li class="item">
          <p>超长质保</p>
        </li>
      </ul>
    </div>
</body>
</html>